package org.naxx.security.naxxlet.model.combiner;

import java.util.Set;

import org.naxx.security.common.Decision;
import org.naxx.security.model.Policy;
import org.naxx.security.model.Rule;
import org.naxx.security.model.Target;
import org.naxx.security.model.request.Request;
import org.naxx.security.model.result.TargetEvaluationResult;

@SuppressWarnings("unused")
final class PolicyEvaluator {

	private RulesCombiner ruleCombiner = new RulesCombiner();

	public Decision evaluate(Policy policy, Request request) {
		Target target = policy.getTarget();
		if (target != null) {
			TargetEvaluationResult targetResult = null;// target.evaluate(
														// requestContext);
			if (TargetEvaluationResult.NO_MATCH.equals(targetResult)) {
				return Decision.NOT_APPLICABLE;
			} else if (TargetEvaluationResult.INDETERMINATE
					.equals(targetResult)) {
				return Decision.INDETERMINATE;
			}
		}
		Set<Rule> rules = policy.getRules();
		Decision rulesDecision = null;// this.ruleCombiner.evaluate(rules,
										// requestContext,
										// RuleCombiningAlgorithm
										// .DENY_OVERRIDES);
		return Decision.PERMIT;
	}
}
